import tkinter as tk
from tkinter import messagebox


class application(tk.Frame):
    def __init__(self, master=None):
        self.master = master
        super().__init__(master)
        self.creatWidget()

    def creatWidget(self):
        v1 = tk.StringVar()
        l1 = tk.Label(self.master, text='用户名').grid(row=0, column=0)
        e1 = tk.Entry(self.master, textvariable=v1).grid(row=0, column=1)

        v2 = tk.StringVar()
        l2 = tk.Label(self.master, text='密码').grid(row=1, column=0)
        e2 = tk.Entry(self.master, textvariable=v2).grid(row=1, column=1)

        l3 = tk.Label(self.master, text='请输入用户名').grid(row=0, column=2)

        b1 = tk.Button(self.master, text='submit', ).grid(row=2, column=1, stick='ew')
        b2 = tk.Button(self.master, text='close').grid(row=2, column=2, stick='ew')


root = tk.Tk()
app = application(root)
root.mainloop()
